<?php

declare(strict_types=1);
/**
 * Created by Vscode
 * User: ChenP
 * Date: 2021-12-03 17:00
 */
namespace App\Controller;

use Hyperf\Di\Annotation\Inject;
use Hyperf\HttpServer\Annotation\AutoController;
use App\Services\GoodsService;

/**
 * @AutoController
 */
class GoodsController extends AbstractController
{
    /**
     * @Inject()
     * @var GoodsService
     */
    protected $goodsService;

    public function list()
    {
        $params = $this->validate();

        $data = $this->goodsService->list($params);

        return $this->send($data);
    }

    public function detail()
    {
        $params = $this->validate();

        $data = $this->goodsService->detail($params);

        return $this->send($data);
    }

    public function get_category()
    {
        // $params = $this->validate();

        $data = $this->goodsService->getCategory();

        return $this->send($data);
    }

    public function goods_exchange()
    {
        $params = $this->validate();

        $data = $this->goodsService->goodsExchange($params);

        return $this->send($data);
    }
}
